import getApiData from "@/services/cpasRequest";

// 
export async function getChangeApiNameData(apiName: string, params: {
    dbname: string;
    Data_ID: string;
    otherWhere: string;
    displayOption?: boolean;
}) {
    if (!params.dbname) return [];
    const res = await getApiData(apiName, params);
    if (res.ok) {
        return Promise.resolve({
            data: res.data,
            success: true,
        });
    }
    return Promise.resolve({
        data: [],
        success: false,
    });
}


export async function getPZBOneVoucherDetail(params: {
    dbname: string;
    Data_ID: string;
    PZRQ: string;
    PZLX: string;
    PZBH: string;
}) {
    if (!params.dbname) return Promise.resolve({
        data: [],
        success: false,
    });;
    const res = await getApiData('account.PZB.getOneVoucherDetail', params);
    if (res.ok) {
        return Promise.resolve({
            data: res.data,
            success: true,
        });
    }
    return Promise.resolve({
        data: [],
        success: false,
    });
}


export async function getPZBOneVoucherDetailOfAssist(params: {
    dbname: string;
    Data_ID: string;
    PZRQ: string;
    PZLX: string;
    PZBH: string;
    FLID?: string;
}) {
    if (!params.dbname) return Promise.resolve({
        data: [],
        success: false,
    });;
    const res = await getApiData('account.PZB.getOneVoucherDetailOfAssist', params);
    if (res.ok) {
        return Promise.resolve({
            data: res.data,
            success: true,
        });
    }
    return Promise.resolve({
        data: [],
        success: false,
    });
}

// getOneVoucherDetailOfAssist


